package com.develop.skwen.electricgomall.category;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.develop.skwen.basemodule.list.BaseItemClickListener;
import com.develop.skwen.basemodule.ui.BaseFragment;
import com.develop.skwen.electricgomall.category.itemList.CategoryItemListAdapter;
import com.develop.skwen.electricgomall.category.list.CategoryListAdapter;
import com.develop.skwen.electricgomall.category.model.CategoryBean;
import com.develop.skwen.electricgomall.category.model.CategoryItemBean;
import com.develop.skwen.electricgomall.util.CategoryDataUtil;

/**
 * Created by skwen
 * on 18-5-29
 */

public class CategoryFragment extends BaseFragment<CategoryContract.CategoryPresenter,CategoryContract.CategoryVu>
        implements CategoryContract.CategoryPresenter {

    private CategoryListAdapter categoryListAdapter;

    private CategoryItemListAdapter categoryItemListAdapter;

    @Override
    protected Class<? extends CategoryContract.CategoryVu> getVuClass() {
        return CategoryView.class;
    }

    @Override
    protected CategoryContract.CategoryPresenter getPresenter() {
        return this;
    }

    @Override
    protected void onBind() {

        categoryListAdapter = new CategoryListAdapter(CategoryDataUtil.getInstance().getCategoryBeans());
        getVu().setCategoryListAdapter(categoryListAdapter);
        categoryListAdapter.setSelectPosition(0);

        categoryItemListAdapter = new CategoryItemListAdapter(CategoryDataUtil.getInstance().getCategoryItemBeans());
        getVu().setCategoryItemListAdapter(categoryItemListAdapter);


    }

    @Override
    public RecyclerView.LayoutManager getLayoutManager() {
        return new LinearLayoutManager(getActivity());
    }

    @Override
    public RecyclerView.LayoutManager getGridLayoutManager() {
        return new GridLayoutManager(getActivity(),3);
    }

    @Override
    public void getCategoryBeanData(CategoryBean categoryBean) {

    }

    @Override
    public void getCategoryItemBeanData(CategoryItemBean categoryItemBean) {

    }
}
